// @Author yy 2024/8/20
package httpClientUtil

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"strings"
)

func DoPostTakeToken(url, param, token string) (resu map[string]interface{}) {
	request, err := http.NewRequest("POST", url, strings.NewReader((param)))
	if err != nil {
		fmt.Println("创建请求失败", err)
	}
	// 设置请求头
	request.Header.Add("Content-Type", "application/json")
	request.Header.Add("Authorization", token)
	request.Header.Add("Accept", "application/json")
	// 发送请求
	res, _ := http.DefaultClient.Do(request)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(res)
	var result map[string]interface{}
	json.Unmarshal(body, &result)
	return result
}
